// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: taekwon

#include <execinfo.h>
#include <gflags/gflags.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>

#include <torch/torch.h>
#include <torch/script.h>


#include "coin2/exchange/base/log/strategy_logger.h"

// DEFINE_string(end_date, "2020-03-01", "end_date");

int main(int argc, char* argv[]) {
  using coin2::exchange::base::strategy_util::StrategyLogReader;
  google::InitGoogleLogging(argv[0]);
  LOG(INFO) << "11";
  LOG(ERROR) << "EVAL";
  torch::Tensor tensor = torch::rand({2, 3});
  torch::Tensor tensor2 = torch::rand({2, 3});
  torch::jit::script::Module module = torch::jit::load(argv[1]);
  for (float x = -5.0; x < 5; x += 0.1) {
    float y = x * x + 3;
    torch::Tensor _x = torch::from_blob(&x, { 1,1 });
    torch::Tensor _y = torch::from_blob(&y, { 1,1 });
    torch::Tensor prediction = module.forward({ _x }).toTensor();
    printf("%f\t%f\t%f\t%f\n", x, y, _x[0][0].item<float>(), prediction[0][0].item<float>());
  }
  // tensor = tensor.cuda();
  std::cout << tensor << std::endl;
  std::cout << tensor2 << std::endl;
  std::cout << tensor + tensor2 << std::endl;
  auto my_sequential = torch::nn::Sequential(torch::nn::Conv2d(1 /*input channels*/, 1 /*output channels*/, 2 /*kernel size*/),
					  torch::nn::Conv2d(1, 1, 2));
  LOG(INFO) << my_sequential;
  return 0;
}
